import 'package:flutter/material.dart';

import 'package:myflutter/order_for_eat/pageManage.dart';

class CustomNavigationRoute extends StatefulWidget {
  const CustomNavigationRoute({super.key});

  @override
  _CustomNavigationRouteState createState() => _CustomNavigationRouteState();
}

int selectedTab = 0;


Widget _inside =  PageManage.homePage;

class _CustomNavigationRouteState extends State<CustomNavigationRoute> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(
      //   title: Text("主页"),
      // ),
      body: Center(
        child: _inside,
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      floatingActionButton: Transform.translate(offset: Offset(0,10),child:
      Transform.scale(scale: 1.24, child:  FloatingActionButton(
        onPressed: () {
          Navigator.pushNamed(context, '/scan');
        },
        child: Icon(Icons.qr_code, size:30,),
      ),),),
      bottomNavigationBar: BottomAppBar(
        height: 65,
        child: NavigationBar(
          selectedIndex: selectedTab,
          onDestinationSelected: (value){
            setState(() {
              selectedTab = value;
              switch (value) {
                case 0:
                  _inside = PageManage.homePage;
                case 3:
                  _inside = PageManage.scanPage;
                case 1:
                  _inside = PageManage.orderPage;
              }
            });
          },
          destinations: [
          NavigationDestination(icon: Icon(Icons.home), label: "home"),
          NavigationDestination(icon: Icon(Icons.home), label: "home",),
          SizedBox(),
          NavigationDestination(icon: Icon(Icons.home), label: "home"),
          NavigationDestination(icon: Icon(Icons.home), label: "home"),
        ],)
      ),
    );
  }
}
